package fr.vvins.core.common;

/**
 * Exception technique du module biz.
 * Regroupe toutes les exception non gérés par les services.
 * 
 * @author fguay
 */
public class TechnicalException extends Exception {

	private static final long serialVersionUID = 664506831801728049L;
	
	private String code;
	
	private String message;
	
	private final static String PREFIX = "TEC-";
	
	public final static String DATABASE = PREFIX + 1;
	
	public final static String CONVERT = PREFIX + 2;

	public static final String ENCODING = PREFIX + 3;
	
	public TechnicalException(String code, String message){
		super(message);
		setCode(code);
		setMessage(message);
	}
	
	public TechnicalException(String code, Throwable cause){
		super(cause.getMessage(), cause);
		setCode(code);
		setMessage(cause.getMessage());
	}
	
	public TechnicalException(String code, String message, Throwable cause){
		super(message, cause);
		setCode(code);
		setMessage(message);
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Override
	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}
	
}
